import { assertEquals } from "asserts";

import majorityElement from "./index.ts";

Deno.test("majority-element", () => {
    const inputs = [
        [3, 2, 3],
        [2, 2, 1, 1, 1, 2, 2],
        [
            2,
            2,
            1,
            1,
            1,
            2,
            2,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
            9,
        ],
    ];
    assertEquals([3, 2, 9], inputs.map(majorityElement));
});
